<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>个案信息查询管理</title>
<meta name="decorator" content="default"/>
<script type="text/javascript">
$(document).ready(function() {
	$(document).on("click","#check",function(){
		var url = "${ctx}/child/childBaseinfo/getChildBaseinfo?childId="+$(this).parent().parent().attr("data-id");
    	layer.open({
			type : 2,
			title : '儿童个案信息',
			shadeClose : true,
			shade : 0.8,
			maxmin: true,
		    success: function(layero,index){
		        //在回调方法中的第2个参数“index”表示的是当前弹窗的索引。
		        //通过layer.full方法将窗口放大。
		        layer.full(index);
		    },
			area : [screen.availWidth * 0.7 + 'px', screen.availHeight * 0.6 + 'px' ],
			content : url
		});
    });
	$(document).on("click","#btnReset",function(){
		debugger;
		$("#areaCodeId").val("");
		$("#areaCodeName").val("");
		$("#startBirthday").val("");
		$("#endBirthday").val("");
		$("#childcode").val("");
		$("#childname").val("");
		$("#gender").val("").select2();
		$("#guardianname").val("");
		$("#guardianidentificationnumber").val("");
		$("#father").val("");
		$("#fathercard").val("");
		$("#reside").val("").select2();
		$("#situation").val("").select2();
		$("#localtype").val("").select2();
	})
});
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
      	return false;
}
function downExcel(){
	top.$.jBox.confirm("确认要导出出入库数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","${ctx}/child/childBaseinfo/exportExcel");
			$("#searchForm").submit();
			$("#searchForm").attr("action","${ctx}/child/childBaseinfo/");
		}
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
}
</script>
<style type="text/css">
	.minWidth {
		min-width: 177px;
	}	
	#contentTable td ,#contentTable th{
		text-align: center;
		padding:1px 10px;
	}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/child/childBaseinfo/">个案信息查询</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="childBaseinfo" action="${ctx}/child/childBaseinfo/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
	<div class="breadcrumb">
		<table class="table table-bordered">	
			<tr>
				<th>地区名称：</th>
				<td>
					<sys:treeselect2 id="areaCode" name="areaCode" value="${childBaseinfo.areaCode}" labelName="areaName" labelValue="${childBaseinfo.areaName}" 
				      title="机构" url="/sys/office/treeData?type=1" cssClass="input-small" allowClear="true"/>
				</td>
				<th>在册情况：</th>
				<td>  
				    <form:select path="situation" id="situation" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('child_situation')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<th>居住情况：</th>
				<td>  
					<form:select path="reside" id="reside" class="span2 minWidth">
					   <form:option value="" label="--请选择--"/> 
					   <form:options items="${fns:getDictList('reside')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>
			<tr>
			    <th>儿童编码：</th>
				<td>
				    <form:input path="childcode" htmlEscape="false" maxlength="50" class="input-medium"/>
				</td>
				<th>姓名：</th>
				<td>
				    <form:input path="childname" htmlEscape="false" maxlength="50" class="input-medium"/>
				</td>
				<th>性别：</th>
				<td>
					<form:select path="gender" id="gender" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>
			<tr>
				<th>出生起始日期：</th>
				<td>
					<input name="startBirthday" id= "startBirthday" type="text" readonly="readonly" maxlength="20" class="span2 input-mini Wdate"
						value="<fmt:formatDate value="${childBaseinfo.startBirthday}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>出生截止日期：</th>
				<td>
				    <input name="endBirthday" id = "endBirthday" type="text" readonly="readonly" maxlength="20" class="span2 input-mini Wdate"
						value="<fmt:formatDate value="${childBaseinfo.endBirthday}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>迁入情况：</th>
				<td>  
					<form:select path="localtype" id="localtype" class="span2 minWidth">
					   <form:option value="" label="--请选择--"/> 
					   <form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>
		</table>
	</div>
	<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	<input id="btnReset"  class="btn btn-primary" type="button" value="重置"/>
	<input onclick="downExcel()"  class="btn btn-primary" type="button" value="导出"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>儿童编码</th>
				<th>姓名</th>
				<th>性别 </th>
				<th>出生日期</th>
				<th>母亲</th>
				<th>母亲身份证号</th>
				<th>母亲手机号</th>
				<th>父亲</th>
				<th>父亲身份证号</th>
				<th>父亲手机号</th>
				<th>现住址</th>
				<th>居住</th>
				<th>在册</th>
				<shiro:hasPermission name="child:childBaseinfo:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="childBaseinfo">
			<tr data-id="${childBaseinfo.id}">
				<td style="width: 50px;"> 
					${childBaseinfo.childcode}
				</td>
				<td width="56px">
					${childBaseinfo.childname}
				</td>
				<td>
					${fns:getDictLabel(childBaseinfo.gender, "sex", "")}
				</td>
				<td>
					<fmt:formatDate value="${childBaseinfo.birthday}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					${childBaseinfo.guardianname}
				</td>
				<td style="width: 50px;">
					${childBaseinfo.guardianidentificationnumber}
				</td>
				<td>
					${childBaseinfo.guardianmobile}
				</td>
				<td>
					${childBaseinfo.father}
				</td>
				<td style="width: 50px;">
					${childBaseinfo.fathercard}
				</td>
				<td>
					${childBaseinfo.fatherphone}
				</td>
				<td>
					${childBaseinfo.address}
				</td>
				<td>
					${fns:getDictLabel(childBaseinfo.reside, "reside", "")}
				</td>
				<td>
					${fns:getDictLabel(childBaseinfo.situation, "child_situation", "")}
				</td>
				<shiro:hasPermission name="child:childBaseinfo:edit"><td>
<%--     				<a href="${ctx}/child/childBaseinfo/form?id=${childBaseinfo.id}">浏览</a> --%>
    				<%-- <a  onclick="window.open('${ctx}/child/childBaseinfo/getChildBaseinfo?childId=${childBaseinfo.id}');" href="#">浏览</a> --%>
    				<a href="javascript:;" id ="check">浏览</a>
<%-- 					<a href="${ctx}/child/childBaseinfo/delete?id=${childBaseinfo.id}" onclick="return confirmx('确认要删除该个案信息查询吗？', this.href)">删除</a> --%>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>